# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=twint
pkgver=845.e7c8a0c7
pkgrel=6
epoch=1
pkgdesc="An advanced Twitter scraping & OSINT tool written in Python that doesn't use Twitter's API, allowing you to scrape a user's followers, following, Tweets and more while evading most API limitations."
groups=('blackarch' 'blackarch-social' 'blackarch-recon')
arch=('any')
url='https://github.com/twintproject/twint'
license=('MIT')
depends=('python' 'python-aiohttp' 'python-aiodns' 'python-beautifulsoup4'
         'python-cchardet' 'python-elasticsearch' 'python-pysocks'
         'python-pandas' 'python-schedule' 'python-geopy' 'python-aiohttp-socks'
         'python-fake-useragent' 'python-googletransx')
makedepends=('git' 'python-setuptools')
source=("git+https://github.com/twintproject/$pkgname.git"
        'cli.py.patch')
sha512sums=('SKIP'
            '6c145623c30a2ba4a1144f3c400e8f617cd537336fab19cab8d4e7fdfd48a6dfdd221d759e6c5962dcc1578e030ab71fc1a42fe0beb124b07715731a12951b36')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  patch -p2 < ../cli.py.patch
}

build() {
  cd $pkgname

  python setup.py build
}

package() {
  cd $pkgname

  python setup.py install --root="$pkgdir" --prefix=/usr --skip-build

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

